﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Actuals.CoreDomain.Business;
using Actuals.CoreDomain;
using Actuals.CoreDomain.Data;
using Actuals.Data;

namespace Actuals.Business
{
    public class BusinessPublicHoliday : IBusinessPublicHoliday
    {

         private IDalPublicHoliday _dalPublicHoliday;

         public BusinessPublicHoliday(IDalPublicHoliday dalPublicHoliday)
        {
            _dalPublicHoliday = dalPublicHoliday;
        }

         public BusinessPublicHoliday()
        {
            _dalPublicHoliday = new DalPublicHoliday();
        }


        #region IBusinessPublicHoliday Members

        public IList<IPublicHoliday> GetPublicHolidays(DateTime FromDate, DateTime ToDate)
        {
           return _dalPublicHoliday.GetPublicHolidays(FromDate,ToDate);
        }
        public bool AddAndUpdatePublicHolidays(IPublicHoliday publicHoliday)
        {
            return _dalPublicHoliday.AddAndUpdatePublicHolidays(publicHoliday);
        }
        public IList<IPublicHoliday> GetPubHolidays(int year)
        {
            return _dalPublicHoliday.GetPubHolidays(year);

        }
        public IPublicHoliday GetPublicHoliday(int id)
        {
            return _dalPublicHoliday.GetPublicHoliday(id);
        }
        public bool DeletePublicHolidays(int id)
        {
            return _dalPublicHoliday.DeletePublicHolidays(id);
        }
        public bool IsPublicHoliday(DateTime date)
        {
            IBusinessPublicHoliday businessPublicHoliday = new BusinessPublicHoliday();
            IList<IPublicHoliday> publicHolidays = businessPublicHoliday.GetPublicHolidays(date,date);
            if (publicHolidays.Count > 0)
                return true;
            else
                return false;
        }
        #endregion
    }
}
